<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$title}</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,客户中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link rel="shortcut icon" href="favicon.ico"> <link href="__STATICADMIN__/css/bootstrap.min.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/font-awesome.min93e3.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/animate.min.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/style.min.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/fileinput.css" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h2>广告添加</h2>
                </div>
                <div class="ibox-content">
                    <form method="post" class="form-horizontal" name="save" id="save" action="{:U('Ad/add')}" enctype="multipart/form-data">
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">广告位</label>
                            <div class="col-sm-10">
                              <select class="form-control" name="type" id="type">
                                  <option value="0">--选择广告位--</option>
                                  <option value="1">--[banner]--</option>
                                  <option value="2">--顶部广告--</option>
                                  <option value="3">--促销广告--</option>
                                  <option value="4">--新品广告--</option>
                                  <option value="5">--限时广告--</option>
                                  <option value="6">--商品广告--</option>
                              </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">广告名字</label>
                            <div class="col-sm-10">
                                <input type="text" placeholder="请填写名字" id="ad_name" name="ad_name" class="form-control">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">链接</label>
                            <div class="col-sm-10">
                                <input type="text" placeholder="请填写要跳转的链接" name="link_url" id="link_url" class="form-control">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">图片上传</label>
                            <div class="col-sm-10">
                                <input type="file" name="pic" id="file" class="file">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">广告时间</label>
                            <div class="col-sm-10">
                                <input type="text"  placeholder="请填写广告时间" name="time" id="time" class="form-control">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">排序</label>
                            <div class="col-sm-10">
                                <input type="text" placeholder="排序" name="order" id="order" class="form-control">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" id="button" type="submit">添加</button>
                                <a href="javascript:history.go(-1)" class="btn btn-white" type="button">取消</a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__STATICADMIN__/js/jquery.min.js"></script>
<script src="__STATICADMIN__/js/jquery.form.js"></script>
<script src="__STATICADMIN__/js/common.js"></script>
<script src="__STATICADMIN__/js/fileinput.min.js"></script>
<script src="__STATICADMIN__/js/zh.js"></script>
<script src="__STATIC__/public/layui/lay/dest/layui.all.js"></script>
</body>
<script>
    $(function(){
        $('#save').ajaxForm({
            beforeSubmit:checkForm,
            success: complete,
            dataType: 'json'
        });
        function checkForm(){
            if($('#ad_name').val() == ''){
                sxshop.error('广告名不能为空');
                return false;
            }

            if($('#type').val() == ''){
                sxshop.error('请选择所属广告的分类');
                return false;
            }
            if($('#link_url').val() == ''){
                sxshop.error('请选择广告要跳转的链接');
                return false;
            }
        }

        function complete(date){
            if(date.state > 0){
                sxshop.error(date.msg);
                return false;
            }else{
                sxshop.success(date.msg,'{:U("Ad/index")}');
            }
        }
    })
</script>
</html>
